package edu.dev.tfile;

import java.util.HashMap;
import java.util.Map;

public class TFileEventManagement {

	private static final TFileEventManagement management = new TFileEventManagement();

	private Map<String, TFileListener> map = new HashMap<String, TFileListener>();

	private TFileEventManagement() {
	}

	public static TFileEventManagement getManagement() {
		return management;
	}

	public void fire(String eventName, String command) {
		if (map.containsKey(eventName)) {
			TFileListener listener = map.get(eventName);
			listener.fire(command);
		}
	}

	public void registerListener(String eventName, TFileListener listener) {
		map.put(eventName, listener);
	}

}
